<!DOCTYPE html>
<html class="x-admin-sm">
    <head>
        <meta charset="UTF-8">
        <title>欢迎页面-X-admin2.2</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
        <link rel="stylesheet" href="/static/admin/css/font.css">
        <link rel="stylesheet" href="/static/admin/css/xadmin.css">

        <!--<link href="http://www.jq22.com/jquery/bootstrap-3.3.4.css" rel="stylesheet">-->

        <script src="/static/admin/lib/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="/static/admin/js/xadmin.js"></script>
        <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
        <!--[if lt IE 9]>
            <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
            <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->

        <script src="http://www.jq22.com/jquery/1.11.1/jquery.min.js"></script>
        <script src="http://www.jq22.com/jquery/bootstrap-3.3.4.js"></script>
        <script src="/static/admin/js/sanji/distpicker.data.js"></script>
        <script src="/static/admin/js/sanji/distpicker.js"></script>
        <script src="/static/admin/js/sanji/main.js"></script>

    </head>
    
    <body>

        <div class="layui-fluid">
            <div class="layui-row">
<!--                <form class="layui-form">-->
                <form onsubmit="return false;">
                    <input type="hidden" name="hr_id" id="hr_id" value="{$hr_id}">
                    <p id="edit_hr_status" style="display: none">{$info.hr_status}</p>
                    <div class="layui-form-item">
                        <label for="hr_serial_number" class="layui-form-label">
                            <span class="x-red">*</span>房源编号
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="hr_serial_number" name="hr_serial_number" readonly value="{$info.hr_serial_number}" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-form-mid layui-word-aux" style="width:150px;">
                            <span class="x-red">*</span>房源唯一标识
                        </div>

                        <label for="hr_sales_id" class="layui-form-label">
                            <span class="x-red">*</span>业务员
                        </label>
                        <div class="layui-input-inline layui-form">
                            <select id ="hr_sales_id" name="hr_sales_id" lay-filter="hr_sales_id">
                                <option value="">请选择业务员</option>
                               {volist name="saleslist" id="salesinfo"}
                                <option value="{$salesinfo.id}"  {compare name="salesinfo.id" value="$info.hr_sales_id" type="eq"}selected{/compare} >{$salesinfo.truename}</option>
                                {/volist}
                            </select>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label for="hr_cm_id" class="layui-form-label">
                            <span class="x-red">*</span>渠道员
                        </label>
                        <div class="layui-input-inline layui-form">
                            <select id ="hr_cm_id" name="hr_cm_id" lay-filter="hr_cm_id">
                                <option value="">请选择渠道员</option>
                                {if !empty($channellist)}
                                {volist name="channellist" id="channellist"}
                                <option value="{$channellist.cm_id}" {compare name="channellist.cm_id" value="$info.hr_cm_id" type="eq"}selected{/compare} >{$channellist.cm_name}</option>
                                {/volist}
                                {/if}
                            </select>
                        </div>

                        <div class="layui-form-mid layui-word-aux" style="width:150px;">
                            <span class="x-red"></span>
                        </div>

                        <label for="hr_owner" class="layui-form-label">
                            <span class="x-red">*</span>业主
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="hr_owner" name="hr_owner" value="{$info.hr_owner}" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label for="hr_owner_phone" class="layui-form-label">
                            <span class="x-red">*</span>业主手机号
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="hr_owner_phone" name="hr_owner_phone" value="{$info.hr_owner_phone}" autocomplete="off" class="layui-input">
                        </div>

                        <div class="layui-form-mid layui-word-aux" style="width:150px;">
                            <span class="x-red"></span>
                        </div>

                        <label for="hr_status" class="layui-form-label">
                            <span class="x-red">*</span>房源状态
                        </label>
                        <div class="layui-input-inline layui-show-xs-block layui-form">
                            <select name="hr_status" id="hr_status">
                                <option value="1" {if condition="$info.hr_status eq '1'"} selected {/if}>未跟进</option>
                                <option value="2" {if condition="$info.hr_status eq '2'"} selected {/if}>已联系</option>
                                <option value="3" {if condition="$info.hr_status eq '3'"} selected {/if}>已实勘</option>
                                <option value="4" {if condition="$info.hr_status eq '4'"} selected {/if}>风控处理</option>
                                <option value="5" {if condition="$info.hr_status eq '5'"} selected {/if}>可签约</option>
                                <option value="6" {if condition="$info.hr_status eq '6'"} selected {/if}>已签约</option>
                                <option value="7" {if condition="$info.hr_status eq '7'"} selected {/if}>已失效</option>
                                <option value="8" {if condition="$info.hr_status eq '8'"} selected {/if}>溢出状态</option>
                            </select>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label for="hr_channel_fee" class="layui-form-label">
                            <span class="x-red">*</span>渠道费
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="hr_channel_fee" name="hr_channel_fee" value="{$info.hr_channel_fee}" autocomplete="off" class="layui-input">
                        </div>

                        <div class="layui-form-mid layui-word-aux" style="width:150px;">
                            <span class="x-red"></span>
                        </div>

                        <label for="hr_city" class="layui-form-label">
                            <span class="x-red">*</span>城市
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="hr_city" name="hr_city" readonly value="{$info.hr_city}" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span class="x-red">*</span>城市
                        </label>
                        <div data-toggle="distpicker3" id="distpicker3">
                            <div class="layui-input-inline" style="width:110px;">
                                <select id="province" style="width:110px;height:30px;"></select>
                            </div>
                            <div class="layui-input-inline" style="width:110px;">
                                <select id="city" style="width:110px;height:30px;"></select>
                            </div>
                            <div class="layui-input-inline" style="width:110px;">
                                <select id="district" style="width:110px;height:30px;"></select>
                            </div>
                        </div>


                        <label for="hr_area_id" class="layui-form-label">
                            <span class="x-red">*</span>区号
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="hr_area_id" name="hr_area_id" readonly value="{$info.hr_area_id}" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label for="hr_bc_id" class="layui-form-label">
                            <span class="x-red">*</span>商圈
                        </label>

                        <div class="layui-input-inline layui-form">
                            <select id ="hr_bc_id" name="hr_bc_id" lay-filter="hr_bc_id">
                                <option value="">请选择商圈</option>
                                {volist name="businesscircle" id="businesscircle"}
                                <option value="{$businesscircle.bc_id}" {compare name="businesscircle.bc_id" value="$info.hr_bc_id" type="eq"} selected {/compare} >{$businesscircle.bc_name}</option>
                                {/volist}
                            </select>
                        </div>

                        <div class="layui-form-mid layui-word-aux" style="width:150px;">
                            <span class="x-red"></span>
                        </div>

                        <label for="hr_rq_id" class="layui-form-label">
                            <span class="x-red">*</span>小区
                        </label>
                        <div class="layui-input-inline layui-form">
                            <select name="hr_rq_id" lay-filter="hr_rq_id" id="hr_rq_id">
                                <option value="">请选择小区</option>
                                {volist name="quarters" id="quarters"}
                                <option value="{$quarters.rq_id}" {compare name="quarters.rq_id" value="$info.hr_rq_id" type="eq"} selected {/compare} >{$quarters.rq_name}</option>
                                {/volist}
                            </select>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label for="hr_entrance" class="layui-form-label">
                            <span class="x-red">*</span>单元入口
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="hr_entrance" name="hr_entrance" lay-verify="required" value="{$info.hr_entrance}" autocomplete="off" class="layui-input">
                        </div>

                        <div class="layui-form-mid layui-word-aux" style="width:150px;">
                            <span class="x-red"></span>
                        </div>

                        <label for="hr_storey" class="layui-form-label">
                            <span class="x-red">*</span>所属楼层
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="hr_storey" name="hr_storey"  value="{$info.hr_storey}" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label for="hr_house_number" class="layui-form-label">
                            <span class="x-red">*</span>门牌号
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="hr_house_number" name="hr_house_number" value="{$info.hr_house_number}" autocomplete="off" class="layui-input">
                        </div>

                        <div class="layui-form-mid layui-word-aux" style="width:150px;">
                            <span class="x-red"></span>
                        </div>

                        <label for="hr_house_area" class="layui-form-label">
                            <span class="x-red">*</span>房源面积
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="hr_house_area" name="hr_house_area" value="{$info.hr_house_area}" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label for="hr_house_area" class="layui-form-label">
                            <span class="x-red">*</span>室
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="hr_room_number" name="hr_room_number" value="{$info.hr_room_number}" autocomplete="off" class="layui-input">
                        </div>

                        <div class="layui-form-mid layui-word-aux" style="width:150px;">
                            <span class="x-red"></span>
                        </div>

                        <label for="hr_house_area" class="layui-form-label">
                            <span class="x-red">*</span>厅
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="hr_parlour_number" name="hr_parlour_number" value="{$info.hr_parlour_number}" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label for="hr_house_area" class="layui-form-label">
                            <span class="x-red">*</span>厨
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="hr_kitchen_number" name="hr_kitchen_number" value="{$info.hr_kitchen_number}" autocomplete="off" class="layui-input">
                        </div>

                        <div class="layui-form-mid layui-word-aux" style="width:150px;">
                            <span class="x-red"></span>
                        </div>

                        <label for="hr_house_area" class="layui-form-label">
                            <span class="x-red">*</span>卫
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="hr_toilet_number" name="hr_toilet_number" value="{$info.hr_toilet_number}" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label for="hr_owner_quotation" class="layui-form-label">
                            <span class="x-red">*</span>业主报价
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="hr_owner_quotation" name="hr_owner_quotation" value="{$info.hr_owner_quotation}" autocomplete="off" class="layui-input">
                        </div>

                        <div class="layui-form-mid layui-word-aux" style="width:150px;">
                            <span class="x-red"></span>
                        </div>

                        <label for="hr_type" class="layui-form-label">
                            <span class="x-red">*</span>房源类型
                        </label>
                        <div class="layui-input-inline layui-show-xs-block layui-form">
                            <select name="hr_type" id="hr_type">
                                <option value="1" {if  condition="$info.hr_type eq '1'"} selected {/if}>公寓类型</option>
                                <option value="2" {if  condition="$info.hr_type eq '2'"} selected {/if}>民宅平层</option>
                                <option value="3" {if  condition="$info.hr_type eq '3'"} selected {/if}>民宅复式</option>
                            </select>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label for="hr_environment" class="layui-form-label">
                            <span class="x-red">*</span>环境情况
                        </label>
                        <div class="layui-input-inline layui-form">
                            <select name="hr_environment" id="hr_environment">
                                <option value="1" {if condition="$info.hr_environment eq '1'"} selected{/if}>干净卫生</option>
                                <option value="2" {if condition="$info.hr_environment eq '2'"} selected{/if}>脏乱混杂</option>
                            </select>
                        </div>

                        <div class="layui-form-mid layui-word-aux" style="width:150px;">
                            <span class="x-red"></span>
                        </div>

                        <label for="hr_enovation" class="layui-form-label">
                            <span class="x-red">*</span>装修情况
                        </label>
                        <div class="layui-input-inline layui-form">
                            <select name="hr_enovation" id="hr_enovation">
                                <option value="1" {if condition="$info.hr_enovation eq '1'"} selected {/if}>精装</option>
                                <option value="2" {if condition="$info.hr_enovation eq '2'"} selected {/if}>简装</option>
                                <option value="2" {if condition="$info.hr_enovation eq '3'"} selected {/if}>毛坯</option>
                            </select>
                        </div>
                    </div>

                    <div class="layui-form-item  layui-form">
                        <label for="hr_is_elevator" class="layui-form-label">
                            <span class="x-red">*</span>是否有电梯
                        </label>
                        <div class="layui-input-inline">
                            <select name="hr_is_elevator" id="hr_is_elevator">
                                <option value="1" {if condition="$info.hr_is_elevator eq '1'"} selected{/if}>有</option>
                                <option value="2" {if condition="$info.hr_is_elevator eq '2'"} selected{/if}>无</option>
                            </select>
                        </div>

                        <div class="layui-form-mid layui-word-aux" style="width:150px;">
                            <span class="x-red"></span>
                        </div>

                        <label for="hr_is_elevator" class="layui-form-label">
                            <span class="x-red">*</span>年统计用量
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="hr_statistics" name="hr_statistics" value="{$info.hr_statistics}" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item  layui-form">
                        <label for="hr_zero" class="layui-form-label">
                            <span class="x-red">*</span>电费清零日期
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="hr_zero" placeholder="格式：2019-11-12" name="hr_zero" value="{$info.hr_zero}" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label for="hr_status" class="layui-form-label"></label>
                        <button class="layui-btn" lay-filter="edit" lay-submit="">编辑</button>
                    </div>
                </form>
            </div>
        </div>
        <script>
            var hr_area_id = $("#hr_area_id").val();
            var province = hr_area_id.substring(0,2)+'0000';
            var city = hr_area_id.substring(0,4)+'00';

            $("#distpicker3").distpicker({
                province: ChineseDistricts['86'][province],
                city: ChineseDistricts[province][city],
                district: ChineseDistricts[city][hr_area_id]
            });

            $("#province,#city,#district").change(function(){

                if ($(this).attr('id') == 'province') {
                    $("#city option:eq(0)").attr("selected",true);
                    $("#district option:eq(0)").attr("selected",true);
                }

                if ($(this).attr('id') == 'city') {
                    $("#district option:eq(0)").attr("selected",true);
                }

                if ($(this).attr('id') == 'district') {
                    $("#hr_area_id").val($(this).find("option:selected").attr("data-code"));
                }

                var address = $("#province option:selected").val()+''+$("#city option:selected").val()+''+$("#district option:selected").val();
                $("#hr_city").val(address);
            });
        </script>

        <script>
            layui.use(['form', 'layer'], function() {

                $ = layui.jquery;
                var form = layui.form,
                layer = layui.layer;

                form.on('select(hr_sales_id)', function(data){
                    sales_id = data.value;      //业务员id
                    $.ajax({
                        type:'post',
                        dataType:'json',
                        data:{"hr_sales_id":sales_id},
                        url:'/admin/HousingRes/salesTochannel',
                        success:function(data){
                            $("#hr_cm_id option:gt(0)").remove();
                            $.each(data.data.channellist, function(k, v) {
                                $('#hr_cm_id').append(new Option(v.cm_name, v.cm_id));
                                //$('#hr_cm_id').append("<option value='"+v.cm_id+"'>"+v.cm_name+"</option>");
                            });

                            form.render('select');
                        },
                        error:function(){
                            layer.msg('请求有误',{time: 2000, icon:6,end:function () {
                                    location.reload();
                                }})
                        },
                    });

                });

                form.on('select(hr_bc_id)', function(data){
                    bc_id = data.value;      //业务员id
                    $.ajax({
                        type:'post',
                        dataType:'json',
                        data:{"hr_bc_id":bc_id},
                        url:'/admin/HousingRes/circleToQuarters',
                        success:function(data){

                            if (data.code==0) {
                                $("#hr_rq_id option:gt(0)").remove();
                            }

                            $.each(data.data, function(k, v) {
                                $('#hr_rq_id').append(new Option(v.rq_name, v.rq_id));
                                //$('#hr_cm_id').append("<option value='"+v.cm_id+"'>"+v.cm_name+"</option>");
                            });
                            form.render('select');
                        },
                        error:function(){
                            layer.msg('请求有误',{time: 2000, icon:6,end:function () {
                                    location.reload();
                                }})
                        },
                    });

                });

                //监听提交
                //form.on('submit(edit)', function(datas) {
                $("form").submit(function(){
                    if ($("#edit_hr_status").html()==6) {
                        layer.msg('已签约房源禁止修改',{time: 1000, icon:6},function(){
                        });
                        return false;
                    }


                    hr_id               = $('#hr_id').val();
                    hr_owner            = $('#hr_owner').val();
                    hr_owner_phone      = $('#hr_owner_phone').val();
                    hr_channel_fee      = $('#hr_channel_fee').val();
                    hr_city             = $('#hr_city').val();
                    hr_area_id          = $('#hr_area_id').val();
                    hr_entrance         = $('#hr_entrance').val();
                    hr_storey           = $('#hr_storey').val();
                    hr_house_number     = $('#hr_house_number').val();
                    hr_house_area       = $('#hr_house_area').val();
                    hr_room_number      = $('#hr_room_number').val();
                    hr_parlour_number   = $('#hr_parlour_number').val();
                    hr_kitchen_number   = $('#hr_kitchen_number').val();
                    hr_toilet_number    = $('#hr_toilet_number').val();
                    hr_owner_quotation  = $('#hr_owner_quotation').val();

                    hr_sales_id         = $("#hr_sales_id option:selected").val();
                    hr_cm_id            = $("#hr_cm_id option:selected").val();
                    hr_status           = $("#hr_status option:selected").val();
                    hr_bc_id            = $("#hr_bc_id option:selected").val();
                    hr_rq_id            = $("#hr_rq_id option:selected").val();
                    hr_type             = $("#hr_type option:selected").val();
                    hr_environment      = $("#hr_environment option:selected").val();
                    hr_enovation        = $("#hr_enovation option:selected").val();
                    hr_is_elevator      = $("#hr_is_elevator option:selected").val();
                    if (hr_owner.trim()=='') {
                        layer.msg('业主不能为空',{time: 1000, icon:6},function(){
                            $("#hr_owner").focus();
                        });
                        return false;
                    }

                    var pattern = /^1[34578]\d{9}$/;

                    if (hr_owner_phone.trim()=='' || !pattern.test(hr_owner_phone.trim())) {
                        layer.msg('业主手机号有误',{time: 1000, icon:6},function(){
                            $("#hr_owner_phone").focus();
                        });
                        return false;
                    }

/*                    if (hr_channel_fee.trim()=='') {
                        layer.msg('渠道费不能为空',{time: 1000, icon:6},function(){
                            $("#hr_channel_fee").focus();
                        });
                        return false;
                    }*/

                    if (hr_city.trim()=='') {
                        layer.msg('城市不能为空',{time: 1000, icon:6},function(){
                            $("#hr_city").focus();
                        });
                        return false;
                    }

                    if (hr_area_id.trim()=='') {
                        layer.msg('区号不能为空',{time: 1000, icon:6},function(){
                            $("#hr_area_id").focus();
                        });
                        return false;
                    }

                    if (hr_entrance.trim()=='') {
                        layer.msg('单元入口不能为空',{time: 1000, icon:6},function(){
                            $("#hr_entrance").focus();
                        });
                        return false;
                    }

                    if (hr_storey.trim()=='') {
                        layer.msg('所属楼层不能为空',{time: 1000, icon:6},function(){
                            $("#hr_storey").focus();
                        });
                        return false;
                    }

                    if (hr_house_number.trim()=='') {
                        layer.msg('门牌号不能为空',{time: 1000, icon:6},function(){
                            $("#hr_house_number").focus();
                        });
                        return false;
                    }

                    if (hr_house_area.trim()=='') {
                        layer.msg('房源面积不能为空',{time: 1000, icon:6},function(){
                            $("#hr_house_area").focus();
                        });
                        return false;
                    }

                    if (hr_room_number.trim()=='') {
                        layer.msg('房间不能为空',{time: 1000, icon:6},function(){
                            $("#hr_room_number").focus();
                        });
                        return false;
                    }

                    if (hr_parlour_number.trim()=='') {
                        layer.msg('厅数量不能为空',{time: 1000, icon:6},function(){
                            $("#hr_parlour_number").focus();
                        });
                        return false;
                    }

                    if (hr_kitchen_number.trim()=='') {
                        layer.msg('厨数量不能为空',{time: 1000, icon:6},function(){
                            $("#hr_kitchen_number").focus();
                        });
                        return false;
                    }

                    if (hr_toilet_number.trim()=='') {
                        layer.msg('卫生间数量不能为空',{time: 1000, icon:6},function(){
                            $("#hr_toilet_number").focus();
                        });
                        return false;
                    }

/*                    if (hr_owner_quotation.trim()=='') {
                        layer.msg('业主报价不能为空',{time: 1000, icon:6},function(){
                            $("#hr_owner_quotation").focus();
                        });
                        return false;
                    }*/

                    if (hr_sales_id.trim()=='') {
                        layer.msg('请选择业务员',{time: 1000, icon:6},function(){
                            $("#hr_sales_id").focus();
                        });
                        return false;
                    }

/*                    if (hr_cm_id.trim()=='') {
                        layer.msg('请选择渠道',{time: 1000, icon:6},function(){
                            $("#hr_cm_id").focus();
                        });
                        return false;
                    }*/
                    if (hr_status.trim()=='') {
                        layer.msg('请选择房源状态',{time: 1000, icon:6},function(){
                            $("#hr_status").focus();
                        });
                        return false;
                    }
                    if (hr_bc_id.trim()=='') {
                        layer.msg('请选择商圈',{time: 1000, icon:6},function(){
                            $("#hr_bc_id").focus();
                        });
                        return false;
                    }

                    if (hr_rq_id.trim()=='') {
                        layer.msg('请选择小区',{time: 1000, icon:6},function(){
                            $("#hr_rq_id").focus();
                        });
                        return false;
                    }
                    if (hr_type.trim()=='') {
                        layer.msg('请选择房源类型',{time: 1000, icon:6},function(){
                            $("#hr_type").focus();
                        });
                        return false;
                    }
                    if (hr_environment.trim()=='') {
                        layer.msg('请选择环境情况',{time: 1000, icon:6},function(){
                            $("#hr_environment").focus();
                        });
                        return false;
                    }
                    if (hr_enovation.trim()=='') {
                        layer.msg('请选择装修情况',{time: 1000, icon:6},function(){
                            $("#hr_enovation").focus();
                        });
                        return false;
                    }
                    if (hr_is_elevator.trim()=='') {
                        layer.msg('是否有电梯必选',{time: 1000, icon:6},function(){
                            $("#hr_is_elevator").focus();
                        });
                        return false;
                    }
                    $.ajax({
                        type: 'POST',
                        url: '/admin/HousingRes/housingEdit',
                        async: false,
                        dataType: 'json',
                        data: {"data":$('form').serialize()},
                        success: function (data) {
                            if (data.code==0) {
                                layer.msg(data.msg,{time: 1000, icon:6},function(){
                                    // 获得frame索引
                                    var index = parent.layer.getFrameIndex(window.name);
                                    //关闭当前frame
                                    parent.layer.close(index);

                                    //刷新父窗口
                                    xadmin.father_reload();

                                });

                            } else {
                                layer.msg(data.msg,{time: 2000, icon:6});
                            }
                        }
                    });
                    return false;
                });
            });
        </script>
    </body>

</html>